<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<% String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>面对面借阅信息新增/修改</title>
	<jsp:include page="../../import.jsp" flush="true" />
	<jsp:include page="../common/warrantCommFunction.jsp" flush="true" />
</head>
<body class="iframeBody">
	<div class="Wrapper">
		<div>
			<form id="ligerForm">
				<div class="fieldset1 tabel_col clearFix">
					<div class="caption">
						<span class="title">面对面借阅信息</span>
					</div>
					<div class="fieldBox col_33">
						<div class="label">借阅人</div>
						<div class="field">
							<input id="borrower" name="borrower" value="${entity.borrower}" type="text" class="ui-textbox" ligerui="width: 160">
							<span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">联系电话</div>
						<div class="field">
							<input id="contactPhone" name="contactPhone" value="${entity.contactPhone}" type="text" class="ui-textbox" ligerui="width: 160">
							<span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">借阅日期</div>
						<div class="field">
							<input id="borrowDate" name="borrowDate" value="${entity.borrowDate}" type="text" class="ui-datepicker" ligerui="width: 160">
							<span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">档案柜编号</div>
						<div class="field">
							<input id="cabinetNo" name="cabinetNo" value="${entity.cabinetNo}" type="text" class="ui-textbox" ligerui="width: 160">
							<span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">档案袋编号</div>
						<div class="field">
							<input id="portfolioNumber" name="portfolioNumber" value="${entity.portfolioNumber}" type="text" class="ui-textbox" ligerui="width: 160">
							<span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">支付表编号</div>
						<div class="field">
							<input id="paylistCode" name="paylistCode" value="${entity.paylistCode}" type="text" class="ui-textbox" ligerui="width: 160">
							<span class="requiredSymbol">*</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">借阅登记人</div>
						<div class="field">
							<input id="borrowBooker" name="borrowBooker" value="${entity.borrowBooker}" type="text" class="ui-textbox" ligerui="width: 160">
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">是否需归还</div>
						<div class="field">
							<select name="isRevert" id="isRevert" ligerui="width: 160">
								<option value="1">是</option>
								<option value="0">否</option>
							</select>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">归还时间</div>
						<div class="field">
							<input id="revertDate" name="revertDate" value="${entity.revertDate}" type="text" class="ui-datepicker" ligerui="width: 160">
						</div>
					</div>
					<div class="fieldBox col_100">
						<div class="label">借阅用途</div>
						<div class="field">
							<input id="borrowUse" name="borrowUse" value="${entity.borrowUse}" type="text" class="ui-textbox">
						</div>
					</div>
		            <div class="fieldBox col_100">
						<div class="label">借阅资料描述</div>
						<div class="field">
							<textarea name="borrowDes" id="borrowDes" rows="3" class="l-textarea" style="width:98%" value="${entity.borrowDes}" ></textarea>
						</div>
					</div>
				</div>
				
				<div class="btnsBox">
					<span id="saveBtn" class="sq-button sq-button-round" onclick="save();">保存</span>
					<span id="closeBtn" class="sq-button sq-button-round" onclick="Remove_navTab();">关闭</span>
				</div>
			</form>
		</div>
	</div>
	<script type="text/javascript">
		$(function() {
			$("#ligerForm").ligerForm({
				validate: true
			});
			setData();//设置数据
			//是否需归还
			//liger.get("isRevert").selectValue("${entity.isRevert}");
	    });
		
		//设置固定字段数据	
		function setData(){
			var form = liger.get("ligerForm");
			if("${entity.id}" != ""){
				form.setData({
					isRevert: "${entity.isRevert}",
					borrowDes: "${entity.borrowDes}",
					borrowDate: renderDate1("${entity.borrowDate}"),
					revertDate: renderDate1("${entity.revertDate}")
		    	});
				//加载日期插件
				$("#borrowDate").trigger("change");
				$("#revertDate").trigger("change");
			}
		}
	
		//保存
		function save(){
			var ligerForm = liger.get("ligerForm");
			if (!ligerForm.valid()) {
				$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
				return false; 
			} 
			//获取表单数据
			var data = ligerForm.getData();
			var wait_dialog = null;
			var id="${entity.id}";
			$.ajax({
				type: 'post',
				dataType: 'json',
				data: data,
				url: '<%=path%>/archive/arcBorrowFace/save.do?id='+id,
				beforeSend: function(){
					wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
				},
				success:function(msg){
					wait_dialog.close();
					if(msg.success == 1){
						$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
						if(id == "") {
							Remove_navTab();//新增，关闭当前页面
						}
					}else{
						$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
					}
				}
			});
		}
		
	</script>
</body>
</html>